Empty lines do not break options sections.#52
Conversation
There are several reasons why an options section can be split by an
empty line, among them are:
- logically grouping;
- aesthetic reasons.
Such style is used, for example, in 'man' program.
An example:
Options:
--before-empty-lines An option before empty lines.
--after-empty-lines An option after empty lines.
|
It is possible to play with this new regular expression here. |
|
Although I think there's merit to this request, adding this test-case causes the Python version of docopt to fail. One of the missions is to maintain feature parity across the variants of docopt. Can you post this in the docopt-py forum; if it's accepted there, then I can accept your patch as the port of that feature. |
|
I have created a pull request in the main docopt repository. |
The proposed changes for docopt can be found in the pull request [339](docopt/docopt#339).
|
Something went wrong with Boost regexs. Other tests are okay. |
The wildcard `.` matches any single character including the newline character in Boost.Regex. So, `[^\\n]` construction is used instead.
| "(?:^|\\n)(" // A section begins at start of a line and consists of: | ||
| "[^\\n]*" + name + "[^\\n]*" // - a line that contains the section's name; and | ||
| "(?:" // - several | ||
| "\\n+[ \\t][^\\n]*" // indented lines possibly separated by empty lines. |
There was a problem hiding this comment.
I believe that there is a better solution for this issue. But that is how it looks like now, so I decided that it is okay to re-use this approach. After all, this issue must be addressed rather in a parallel pull request than in this one.
There are several reasons why an options section can be split by an
empty line, among them are:
Such style is used, for example, in
manprogram.An example: